home *** CD-ROM | disk | FTP | other *** search
/ Komputer for Alle 1999 #5 / 1999 CD 5 (black).iso / Delphi3 / install / data.z / OLEDLG.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1997-08-04  |  32.8 KB  |  800 lines

  1.  
  2. {*******************************************************}
  3. {                                                       }
  4. {       Delphi Runtime Library                          }
  5. {       Windows 32bit API Interface Unit                }
  6. {                                                       }
  7. {       Copyright (c) 1996,97 Borland International     }
  8. {                                                       }
  9. {*******************************************************}
  10.  
  11. unit OleDlg;
  12.  
  13. {$WEAKPACKAGEUNIT}
  14.  
  15. interface
  16.  
  17. uses Windows, CommCtrl, ActiveX;
  18.  
  19. const
  20.  
  21. { Help Button Identifier }
  22.  
  23.   IDC_OLEUIHELP                   = 99;
  24.  
  25. { Insert Object Dialog identifiers }
  26.  
  27.   IDC_IO_CREATENEW                = 2100;
  28.   IDC_IO_CREATEFROMFILE           = 2101;
  29.   IDC_IO_LINKFILE                 = 2102;
  30.   IDC_IO_OBJECTTYPELIST           = 2103;
  31.   IDC_IO_DISPLAYASICON            = 2104;
  32.   IDC_IO_CHANGEICON               = 2105;
  33.   IDC_IO_FILE                     = 2106;
  34.   IDC_IO_FILEDISPLAY              = 2107;
  35.   IDC_IO_RESULTIMAGE              = 2108;
  36.   IDC_IO_RESULTTEXT               = 2109;
  37.   IDC_IO_ICONDISPLAY              = 2110;
  38.   IDC_IO_OBJECTTYPETEXT           = 2111;
  39.   IDC_IO_FILETEXT                 = 2112;
  40.   IDC_IO_FILETYPE                 = 2113;
  41.   IDC_IO_INSERTCONTROL            = 2114;
  42.   IDC_IO_ADDCONTROL               = 2115;
  43.   IDC_IO_CONTROLTYPELIST          = 2116;
  44.  
  45. { Paste Special Dialog identifiers }
  46.  
  47.   IDC_PS_PASTE                    = 500;
  48.   IDC_PS_PASTELINK                = 501;
  49.   IDC_PS_SOURCETEXT               = 502;
  50.   IDC_PS_PASTELIST                = 503;
  51.   IDC_PS_PASTELINKLIST            = 504;
  52.   IDC_PS_DISPLAYLIST              = 505;
  53.   IDC_PS_DISPLAYASICON            = 506;
  54.   IDC_PS_ICONDISPLAY              = 507;
  55.   IDC_PS_CHANGEICON               = 508;
  56.   IDC_PS_RESULTIMAGE              = 509;
  57.   IDC_PS_RESULTTEXT               = 510;
  58.  
  59. { Change Icon Dialog identifiers }
  60.  
  61.   IDC_CI_GROUP                    = 120;
  62.   IDC_CI_CURRENT                  = 121;
  63.   IDC_CI_CURRENTICON              = 122;
  64.   IDC_CI_DEFAULT                  = 123;
  65.   IDC_CI_DEFAULTICON              = 124;
  66.   IDC_CI_FROMFILE                 = 125;
  67.   IDC_CI_FROMFILEEDIT             = 126;
  68.   IDC_CI_ICONLIST                 = 127;
  69.   IDC_CI_LABEL                    = 128;
  70.   IDC_CI_LABELEDIT                = 129;
  71.   IDC_CI_BROWSE                   = 130;
  72.   IDC_CI_ICONDISPLAY              = 131;
  73.  
  74. { Convert Dialog identifiers }
  75.  
  76.   IDC_CV_OBJECTTYPE               = 150;
  77.   IDC_CV_DISPLAYASICON            = 152;
  78.   IDC_CV_CHANGEICON               = 153;
  79.   IDC_CV_ACTIVATELIST             = 154;
  80.   IDC_CV_CONVERTTO                = 155;
  81.   IDC_CV_ACTIVATEAS               = 156;
  82.   IDC_CV_RESULTTEXT               = 157;
  83.   IDC_CV_CONVERTLIST              = 158;
  84.   IDC_CV_ICONDISPLAY              = 165;
  85.  
  86. { Edit Links Dialog identifiers }
  87.  
  88.   IDC_EL_CHANGESOURCE             = 201;
  89.   IDC_EL_AUTOMATIC                = 202;
  90.   IDC_EL_CANCELLINK               = 209;
  91.   IDC_EL_UPDATENOW                = 210;
  92.   IDC_EL_OPENSOURCE               = 211;
  93.   IDC_EL_MANUAL                   = 212;
  94.   IDC_EL_LINKSOURCE               = 216;
  95.   IDC_EL_LINKTYPE                 = 217;
  96.   IDC_EL_LINKSLISTBOX             = 206;
  97.   IDC_EL_COL1                     = 220;
  98.   IDC_EL_COL2                     = 221;
  99.   IDC_EL_COL3                     = 222;
  100.  
  101. { Busy dialog identifiers }
  102.  
  103.   IDC_BZ_RETRY                    = 600;
  104.   IDC_BZ_ICON                     = 601;
  105.   IDC_BZ_MESSAGE1                 = 602;
  106.   IDC_BZ_SWITCHTO                 = 604;
  107.  
  108. { Update Links dialog identifiers }
  109.  
  110.   IDC_UL_METER                    = 1029;
  111.   IDC_UL_STOP                     = 1030;
  112.   IDC_UL_PERCENT                  = 1031;
  113.   IDC_UL_PROGRESS                 = 1032;
  114.  
  115. { User Prompt dialog identifiers }
  116.  
  117.   IDC_PU_LINKS                    = 900;
  118.   IDC_PU_TEXT                     = 901;
  119.   IDC_PU_CONVERT                  = 902;
  120.   IDC_PU_ICON                     = 908;
  121.  
  122. { General Properties identifiers }
  123.  
  124.   IDC_GP_OBJECTNAME               = 1009;
  125.   IDC_GP_OBJECTTYPE               = 1010;
  126.   IDC_GP_OBJECTSIZE               = 1011;
  127.   IDC_GP_CONVERT                  = 1013;
  128.   IDC_GP_OBJECTICON               = 1014;
  129.   IDC_GP_OBJECTLOCATION           = 1022;
  130.  
  131. { View Properties identifiers }
  132.  
  133.   IDC_VP_PERCENT                  = 1000;
  134.   IDC_VP_CHANGEICON               = 1001;
  135.   IDC_VP_EDITABLE                 = 1002;
  136.   IDC_VP_ASICON                   = 1003;
  137.   IDC_VP_RELATIVE                 = 1005;
  138.   IDC_VP_SPIN                     = 1006;
  139.   IDC_VP_SCALETXT                 = 1034;
  140.   IDC_VP_ICONDISPLAY              = 1021;
  141.   IDC_VP_RESULTIMAGE              = 1033;
  142.  
  143. { Link Properties identifiers }
  144.  
  145.   IDC_LP_OPENSOURCE               = 1006;
  146.   IDC_LP_UPDATENOW                = 1007;
  147.   IDC_LP_BREAKLINK                = 1008;
  148.   IDC_LP_LINKSOURCE               = 1012;
  149.   IDC_LP_CHANGESOURCE             = 1015;
  150.   IDC_LP_AUTOMATIC                = 1016;
  151.   IDC_LP_MANUAL                   = 1017;
  152.   IDC_LP_DATE                     = 1018;
  153.   IDC_LP_TIME                     = 1019;
  154.  
  155. { Dialog Identifiers as passed in Help messages to identify the source }
  156.  
  157.   IDD_INSERTOBJECT                = 1000;
  158.   IDD_CHANGEICON                  = 1001;
  159.   IDD_CONVERT                     = 1002;
  160.   IDD_PASTESPECIAL                = 1003;
  161.   IDD_EDITLINKS                   = 1004;
  162.   IDD_BUSY                        = 1006;
  163.   IDD_UPDATELINKS                 = 1007;
  164.   IDD_CHANGESOURCE                = 1009;
  165.   IDD_INSERTFILEBROWSE            = 1010;
  166.   IDD_CHANGEICONBROWSE            = 1011;
  167.   IDD_CONVERTONLY                 = 1012;
  168.   IDD_CHANGESOURCE4               = 1013;
  169.   IDD_GNRLPROPS                   = 1100;
  170.   IDD_VIEWPROPS                   = 1101;
  171.   IDD_LINKPROPS                   = 1102;
  172.  
  173. { The following Dialogs are message dialogs used by OleUIPromptUser API }
  174.  
  175.   IDD_CANNOTUPDATELINK            = 1008;
  176.   IDD_LINKSOURCEUNAVAILABLE       = 1020;
  177.   IDD_SERVERNOTFOUND              = 1023;
  178.   IDD_OUTOFMEMORY                 = 1024;
  179.   IDD_SERVERNOTREG                = 1021;
  180.   IDD_LINKTYPECHANGED             = 1022;
  181.  
  182. { Delimeter used to separate ItemMoniker pieces of a composite moniker }
  183.  
  184.   OLESTDDELIM = '\';
  185.  
  186. { Strings for registered messages }
  187.  
  188.   SZOLEUI_MSG_HELP                = 'OLEUI_MSG_HELP';
  189.   SZOLEUI_MSG_ENDDIALOG           = 'OLEUI_MSG_ENDDIALOG';
  190.   SZOLEUI_MSG_BROWSE              = 'OLEUI_MSG_BROWSE';
  191.   SZOLEUI_MSG_CHANGEICON          = 'OLEUI_MSG_CHANGEICON';
  192.   SZOLEUI_MSG_CLOSEBUSYDIALOG     = 'OLEUI_MSG_CLOSEBUSYDIALOG';
  193.   SZOLEUI_MSG_CONVERT             = 'OLEUI_MSG_CONVERT';
  194.   SZOLEUI_MSG_CHANGESOURCE        = 'OLEUI_MSG_CHANGESOURCE';
  195.   SZOLEUI_MSG_ADDCONTROL          = 'OLEUI_MSG_ADDCONTROL';
  196.   SZOLEUI_MSG_BROWSE_OFN          = 'OLEUI_MSG_BROWSE_OFN';
  197.  
  198. { Identifiers for SZOLEUI_MSG_BROWSE_OFN (in wParam) }
  199.  
  200.   ID_BROWSE_CHANGEICON            = 1;
  201.   ID_BROWSE_INSERTFILE            = 2;
  202.   ID_BROWSE_ADDCONTROL            = 3;
  203.   ID_BROWSE_CHANGESOURCE          = 4;
  204.  
  205. { Standard success/error definitions }
  206.  
  207.   OLEUI_FALSE                     = 0;
  208.   OLEUI_SUCCESS                   = 1;   { No error, same as OLEUI_OK }
  209.   OLEUI_OK                        = 1;   { OK button pressed }
  210.   OLEUI_CANCEL                    = 2;   { Cancel button pressed }
  211.  
  212.   OLEUI_ERR_STANDARDMIN           = 100;
  213.   OLEUI_ERR_STRUCTURENULL         = 101; { Standard field validation }
  214.   OLEUI_ERR_STRUCTUREINVALID      = 102;
  215.   OLEUI_ERR_CBSTRUCTINCORRECT     = 103;
  216.   OLEUI_ERR_HWNDOWNERINVALID      = 104;
  217.   OLEUI_ERR_LPSZCAPTIONINVALID    = 105;
  218.   OLEUI_ERR_LPFNHOOKINVALID       = 106;
  219.   OLEUI_ERR_HINSTANCEINVALID      = 107;
  220.   OLEUI_ERR_LPSZTEMPLATEINVALID   = 108;
  221.   OLEUI_ERR_HRESOURCEINVALID      = 109;
  222.  
  223.   OLEUI_ERR_FINDTEMPLATEFAILURE   = 110; { Initialization errors }
  224.   OLEUI_ERR_LOADTEMPLATEFAILURE   = 111;
  225.   OLEUI_ERR_DIALOGFAILURE         = 112;
  226.   OLEUI_ERR_LOCALMEMALLOC         = 113;
  227.   OLEUI_ERR_GLOBALMEMALLOC        = 114;
  228.   OLEUI_ERR_LOADSTRING            = 115;
  229.   OLEUI_ERR_OLEMEMALLOC           = 116;
  230.  
  231.   OLEUI_ERR_STANDARDMAX           = 117; { Start here for specific errors }
  232.  
  233. { Hook type used in all structures }
  234.  
  235. type
  236.   TFNOleUIHook = function(Wnd: HWnd; Msg, WParam, LParam: Longint): Longint stdcall;
  237.  
  238. { Miscellaneous utility functions }
  239.  
  240. function OleUIAddVerbMenu(oleObj: IOleObject; pszShortType: PChar;
  241.   menu: HMenu; uPos: Integer; uIDVerbMin: Integer; uIDVerbMax: Integer;
  242.   bAddConvert: BOOL; idConvert: Integer; var outMenu: HMenu): BOOL; stdcall;
  243.  
  244. { **** Insert Object dialog **** }
  245.  
  246. { Insert object dialog structure }
  247.  
  248. type
  249.   POleUIInsertObject = ^TOleUIInsertObject;
  250.   TOleUIInsertObject = record
  251.     cbStruct: Longint;                  { Structure Size }
  252.     dwFlags: Longint;                   { IN-OUT: Flags }
  253.     hWndOwner: HWnd;                    { Owning window }
  254.     lpszCaption: PChar;                 { Dialog caption bar contents }
  255.     lpfnHook: TFNOleUIHook;             { Hook callback }
  256.     lCustData: Longint;                 { Custom data to pass to hook }
  257.     hInstance: THandle;                 { Instance for customized template name }
  258.     lpszTemplate: PChar;                { Customized template name }
  259.     hResource: HRsrc;                   { Customized template handle }
  260.     clsid: TCLSID;                      { OUT: Return space for class ID }
  261.     lpszFile: PChar;                    { IN-OUT: Filename for inserts or links }
  262.     cchFile: Integer;                   { IN: Size of lpszFile buffer: MAX_PATH }
  263.     cClsidExclude: Integer;             { IN: CLSIDs in lpClsidExclude }
  264.     lpClsidExclude: PCLSID;             { IN: List of CLSIDs to exclude from listing }
  265.     iid: TIID;                          { IN: Requested interface on creation }
  266.     oleRender: Longint;                 { IN: Rendering option }
  267.     lpFormatEtc: PFormatEtc;            { IN: Desired format }
  268.     lpIOleClientSite: IOleClientSite;   { IN: Site to be use for the object }
  269.     lpIStorage: IStorage;               { IN: Storage used for the object }
  270.     ppvObj: Pointer;                    { OUT: Where the object is returned }
  271.     sc: HResult;                        { OUT: Result of creation calls }
  272.     hMetaPict: HGlobal;                 { OUT: metafile aspect (METAFILEPICT) }
  273.   end;
  274.  
  275. { Insert object dialog function }
  276.  
  277. function OleUIInsertObject(var Info: TOleUIInsertObject): Integer; stdcall;
  278.  
  279. { Insert Object flags }
  280.  
  281. const
  282.   IOF_SHOWHELP                    = $00000001;
  283.   IOF_SELECTCREATENEW             = $00000002;
  284.   IOF_SELECTCREATEFROMFILE        = $00000004;
  285.   IOF_CHECKLINK                   = $00000008;
  286.   IOF_CHECKDISPLAYASICON          = $00000010;
  287.   IOF_CREATENEWOBJECT             = $00000020;
  288.   IOF_CREATEFILEOBJECT            = $00000040;
  289.   IOF_CREATELINKOBJECT            = $00000080;
  290.   IOF_DISABLELINK                 = $00000100;
  291.   IOF_VERIFYSERVERSEXIST          = $00000200;
  292.   IOF_DISABLEDISPLAYASICON        = $00000400;
  293.   IOF_HIDECHANGEICON              = $00000800;
  294.   IOF_SHOWINSERTCONTROL           = $00001000;
  295.   IOF_SELECTCREATECONTROL         = $00002000;
  296.  
  297. { Insert Object specific error codes }
  298.  
  299. const
  300.   OLEUI_IOERR_LPSZFILEINVALID         = OLEUI_ERR_STANDARDMAX + 0;
  301.   OLEUI_IOERR_LPSZLABELINVALID        = OLEUI_ERR_STANDARDMAX + 1;
  302.   OLEUI_IOERR_HICONINVALID            = OLEUI_ERR_STANDARDMAX + 2;
  303.   OLEUI_IOERR_LPFORMATETCINVALID      = OLEUI_ERR_STANDARDMAX + 3;
  304.   OLEUI_IOERR_PPVOBJINVALID           = OLEUI_ERR_STANDARDMAX + 4;
  305.   OLEUI_IOERR_LPIOLECLIENTSITEINVALID = OLEUI_ERR_STANDARDMAX + 5;
  306.   OLEUI_IOERR_LPISTORAGEINVALID       = OLEUI_ERR_STANDARDMAX + 6;
  307.   OLEUI_IOERR_SCODEHASERROR           = OLEUI_ERR_STANDARDMAX + 7;
  308.   OLEUI_IOERR_LPCLSIDEXCLUDEINVALID   = OLEUI_ERR_STANDARDMAX + 8;
  309.   OLEUI_IOERR_CCHFILEINVALID          = OLEUI_ERR_STANDARDMAX + 9;
  310.  
  311. { **** Paste Special dialog **** }
  312.  
  313. { The OLEUIPASTE_xxx values are used by the TOleUIPasteEntry structure.
  314.  
  315.   OLEUIPASTE_ENABLEICON: If the container does not specify this flag for
  316.        the entry in the TOleUIPasteEntry array passed as input to
  317.        OleUIPasteSpecial, the DisplayAsIcon button will be unchecked and
  318.        disabled when the the user selects the format that corresponds to
  319.        the entry.
  320.  
  321.   OLEUIPASTE_PASTEONLY: Indicates that the entry in the TOleUIPasteEntry
  322.        array is valid for pasting only.
  323.  
  324.   OLEUIPASTE_PASTE: Indicates that the entry in the TOleUIPasteEntry array
  325.        is valid for pasting. It may also be valid for linking if any of
  326.        the following linking flags are specified.
  327.  
  328.   If the entry in the TOleUIPasteEntry array is valid for linking, the
  329.   following flags indicate which link types are acceptable by OR'ing
  330.   together the appropriate OLEUIPASTE_LINKTYPE<#> values.
  331.  
  332.   These values correspond as follows to the array of link types passed to
  333.   OleUIPasteSpecial:
  334.  
  335.     OLEUIPASTE_LINKTYPE1 = arrLinkTypes[0]
  336.     OLEUIPASTE_LINKTYPE2 = arrLinkTypes[1]
  337.     OLEUIPASTE_LINKTYPE3 = arrLinkTypes[2]
  338.     OLEUIPASTE_LINKTYPE4 = arrLinkTypes[3]
  339.     OLEUIPASTE_LINKTYPE5 = arrLinkTypes[4]
  340.     OLEUIPASTE_LINKTYPE6 = arrLinkTypes[5]
  341.     OLEUIPASTE_LINKTYPE7 = arrLinkTypes[6]
  342.     OLEUIPASTE_LINKTYPE8 = arrLinkTypes[7]
  343.  
  344.   where,
  345.     UINT arrLinkTypes[8] is an array of registered clipboard formats for
  346.     linking. A maximium of 8 link types are allowed. }
  347.  
  348. const
  349.   OLEUIPASTE_ENABLEICON    = 2048;  { enable display as icon }
  350.   OLEUIPASTE_PASTEONLY     = 0;
  351.   OLEUIPASTE_PASTE         = 512;
  352.   OLEUIPASTE_LINKANYTYPE   = 1024;
  353.   OLEUIPASTE_LINKTYPE1     = 1;
  354.   OLEUIPASTE_LINKTYPE2     = 2;
  355.   OLEUIPASTE_LINKTYPE3     = 4;
  356.   OLEUIPASTE_LINKTYPE4     = 8;
  357.   OLEUIPASTE_LINKTYPE5     = 16;
  358.   OLEUIPASTE_LINKTYPE6     = 32;
  359.   OLEUIPASTE_LINKTYPE7     = 64;
  360.   OLEUIPASTE_LINKTYPE8     = 128;
  361.  
  362. { TOleUIPasteEntry structure
  363.  
  364.   An array of TOleUIPasteEntry entries is specified for the PasteSpecial
  365.   dialog box. Each entry includes a TFormatEtc which specifies the
  366.   formats that are acceptable, a string that is to represent the format
  367.   in the  dialog's list box, a string to customize the result text of the
  368.   dialog and a set of flags from the OLEUIPASTE_xxx constants.  The
  369.   flags indicate if the entry is valid for pasting only, linking only or
  370.   both pasting and linking. }
  371.  
  372. type
  373.   POleUIPasteEntry = ^TOleUIPasteEntry;
  374.   TOleUIPasteEntry = record
  375.     fmtetc: TFormatEtc;         { Format that is acceptable }
  376.     lpstrFormatName: PChar;     { String that represents the format
  377.                                   to the user. %s is replaced by the
  378.                                   full user type name of the object }
  379.     lpstrResultText: PChar;     { String to customize the result text
  380.                                   of the dialog when the user
  381.                                   selects the format correspoding to
  382.                                   this entry. Any %s in this string
  383.                                   is replaced by the the application
  384.                                   name or FullUserTypeName of the
  385.                                   object on the clipboard }
  386.     dwFlags: Longint;           { Values from OLEUIPASTE_xxx set }
  387.     dwScratchSpace: Longint;    { Scratch space used internally }
  388.   end;
  389.  
  390. { Maximum number of link types }
  391.  
  392. const
  393.   PS_MAXLINKTYPES = 8;
  394.  
  395. type
  396.   POleUIPasteSpecial = ^TOleUIPasteSpecial;
  397.   TOleUIPasteSpecial = record
  398.     cbStruct: Longint;                  { Structure Size }
  399.     dwFlags: Longint;                   { IN-OUT: Flags }
  400.     hWndOwner: HWnd;                    { Owning window }
  401.     lpszCaption: PChar;                 { Dialog caption bar contents }
  402.     lpfnHook: TFNOleUIHook;             { Hook callback }
  403.     lCustData: Longint;                 { Custom data to pass to hook }
  404.     hInstance: THandle;                 { Instance for customized template name }
  405.     lpszTemplate: PChar;                { Customized template name }
  406.     hResource: HRsrc;                   { Customized template handle }
  407.     lpSrcDataObj: IDataObject;          { IN-OUT: Source IDataObject on the clipboard }
  408.     arrPasteEntries: POleUIPasteEntry;  { IN: Array of acceptable formats }
  409.     cPasteEntries: Integer;             { IN: No. of TOleUIPasteEntry array entries }
  410.     arrLinkTypes: PLongint;             { IN: List of acceptable link types }
  411.     cLinkTypes: Integer;                { IN: Number of link types }
  412.     cClsidExclude: Integer;             { IN: Number of CLSIDs in lpClsidExclude }
  413.     lpClsidExclude: PCLSID;             { IN: List of CLSIDs to exclude from list }
  414.     nSelectedIndex: Integer;            { OUT: Index that the user selected }
  415.     fLink: BOOL;                        { OUT: Indicates if Paste or PasteLink }
  416.     hMetaPict: HGlobal;                 { OUT: Handle to Metafile containing icon }
  417.     sizel: TSize;                       { OUT: size of object/link in its source
  418.                                           may be 0,0 if different display
  419.                                           aspect is chosen }
  420.   end;
  421.  
  422. function OleUIPasteSpecial(var Info: TOleUIPasteSpecial): Integer; stdcall;
  423.  
  424. { Paste Special specific flags }
  425.  
  426. const
  427.   PSF_SHOWHELP                    = $00000001;
  428.   PSF_SELECTPASTE                 = $00000002;
  429.   PSF_SELECTPASTELINK             = $00000004;
  430.   PSF_CHECKDISPLAYASICON          = $00000008;
  431.   PSF_DISABLEDISPLAYASICON        = $00000010;
  432.   PSF_HIDECHANGEICON              = $00000020;
  433.   PSF_STAYONCLIPBOARDCHANGE       = $00000040;
  434.   PSF_NOREFRESHDATAOBJECT         = $00000080;
  435.  
  436. { Paste Special specific error codes }
  437.  
  438. const
  439.   OLEUI_IOERR_SRCDATAOBJECTINVALID   = OLEUI_ERR_STANDARDMAX + 0;
  440.   OLEUI_IOERR_ARRPASTEENTRIESINVALID = OLEUI_ERR_STANDARDMAX + 1;
  441.   OLEUI_IOERR_ARRLINKTYPESINVALID    = OLEUI_ERR_STANDARDMAX + 2;
  442.   OLEUI_PSERR_CLIPBOARDCHANGED       = OLEUI_ERR_STANDARDMAX + 3;
  443.   OLEUI_PSERR_GETCLIPBOARDFAILED     = OLEUI_ERR_STANDARDMAX + 4;
  444.  
  445. { **** Edit Links dialog **** }
  446.  
  447. { IOleUILinkContainer interface
  448.  
  449.   This interface must be implemented by container applications that
  450.   want to use the EditLinks dialog. the EditLinks dialog calls back
  451.   to the container app to perform the OLE functions to manipulate
  452.   the links within the container. }
  453.  
  454. type
  455.   IOleUILinkContainer = interface(IUnknown)
  456.   ['{00000000-0000-0000-0000-000000000000}']  //!!!
  457.     function GetNextLink(dwLink: Longint): Longint; stdcall;
  458.     function SetLinkUpdateOptions(dwLink: Longint; dwUpdateOpt: Longint): HResult; stdcall;
  459.     function GetLinkUpdateOptions(dwLink: Longint;
  460.       var dwUpdateOpt: Longint): HResult; stdcall;
  461.     function SetLinkSource(dwLink: Longint; pszDisplayName: PChar;
  462.       lenFileName: Longint; var chEaten: Longint;
  463.       fValidateSource: BOOL): HResult; stdcall;
  464.     function GetLinkSource(dwLink: Longint; var pszDisplayName: PChar;
  465.       var lenFileName: Longint; var pszFullLinkType: PChar;
  466.       var pszShortLinkType: PChar; var fSourceAvailable: BOOL;
  467.       var fIsSelected: BOOL): HResult; stdcall;
  468.     function OpenLinkSource(dwLink: Longint): HResult; stdcall;
  469.     function UpdateLink(dwLink: Longint; fErrorMessage: BOOL;
  470.       fErrorAction: BOOL): HResult; stdcall;
  471.     function CancelLink(dwLink: Longint): HResult; stdcall;
  472.   end;
  473.  
  474. { TOleIUEditLinks structure }
  475.  
  476. type
  477.   POleUIEditLinks = ^TOleUIEditLinks;
  478.   TOleUIEditLinks = record
  479.     cbStruct: Longint;                  { Structure Size }
  480.     dwFlags: Longint;                   { IN-OUT: Flags }
  481.     hWndOwner: HWnd;                    { Owning window }
  482.     lpszCaption: PChar;                 { Dialog caption bar contents }
  483.     lpfnHook: TFNOleUIHook;             { Hook callback }
  484.     lCustData: Longint;                 { Custom data to pass to hook }
  485.     hInstance: THandle;                 { Instance for customized template name }
  486.     lpszTemplate: PChar;                { Customized template name }
  487.     hResource: HRsrc;                   { Customized template handle }
  488.     OleUILinkContainer: IOleUILinkContainer; { IN: Interface to manipulate
  489.                                           links in the container }
  490.   end;
  491.  
  492. const
  493.   OLEUI_ELERR_LINKCNTRNULL    = OLEUI_ERR_STANDARDMAX + 0;
  494.   OLEUI_ELERR_LINKCNTRINVALID = OLEUI_ERR_STANDARDMAX + 1;
  495.  
  496. function OleUIEditLinks(var Info: TOleUIEditLinks): Integer; stdcall;
  497.  
  498. { Edit Links flags }
  499.  
  500. const
  501.   ELF_SHOWHELP                    = $00000001;
  502.   ELF_DISABLEUPDATENOW            = $00000002;
  503.   ELF_DISABLEOPENSOURCE           = $00000004;
  504.   ELF_DISABLECHANGESOURCE         = $00000008;
  505.   ELF_DISABLECANCELLINK           = $00000010;
  506.  
  507. { **** Change Icon dialog **** }
  508.  
  509. type
  510.   POleUIChangeIcon = ^TOleUIChangeIcon;
  511.   TOleUIChangeIcon = record
  512.     cbStruct: Longint;                  { Structure Size }
  513.     dwFlags: Longint;                   { IN-OUT: Flags }
  514.     hWndOwner: HWnd;                    { Owning window }
  515.     lpszCaption: PChar;                 { Dialog caption bar contents }
  516.     lpfnHook: TFNOleUIHook;             { Hook callback }
  517.     lCustData: Longint;                 { Custom data to pass to hook }
  518.     hInstance: THandle;                 { Instance for customized template name }
  519.     lpszTemplate: PChar;                { Customized template name }
  520.     hResource: HRsrc;                   { Customized template handle }
  521.     hMetaPict: HGlobal;                 { IN-OUT: Current and final image.
  522.                                           Source of the icon is embedded in
  523.                                           the metafile itself }
  524.     clsid: TCLSID;                      { IN: class used to get Default icon }
  525.     szIconExe: array[0..MAX_PATH - 1] of Char; { IN: exlicit icon source path }
  526.     cchIconExe: Integer;                { IN: number of characters in szIconExe }
  527.   end;
  528.  
  529. function OleUIChangeIcon(var Info: TOleUIChangeIcon): Integer; stdcall;
  530.  
  531. { Change Icon flags }
  532.  
  533. const
  534.   CIF_SHOWHELP                    = $00000001;
  535.   CIF_SELECTCURRENT               = $00000002;
  536.   CIF_SELECTDEFAULT               = $00000004;
  537.   CIF_SELECTFROMFILE              = $00000008;
  538.   CIF_USEICONEXE                  = $00000010;
  539.  
  540. { Change Icon specific error codes }
  541.  
  542. const
  543.   OLEUI_CIERR_MUSTHAVECLSID           = OLEUI_ERR_STANDARDMAX + 0;
  544.   OLEUI_CIERR_MUSTHAVECURRENTMETAFILE = OLEUI_ERR_STANDARDMAX + 1;
  545.   OLEUI_CIERR_SZICONEXEINVALID        = OLEUI_ERR_STANDARDMAX + 2;
  546.  
  547. { Property used by ChangeIcon dialog to give its parent window access to
  548.   its hDlg. The PasteSpecial dialog may need to force the ChgIcon dialog
  549.   down if the clipboard contents change underneath it. If so it will send
  550.   a IDCANCEL command to the ChangeIcon dialog. }
  551.  
  552. const
  553.   PROP_HWND_CHGICONDLG = 'HWND_CIDLG';
  554.  
  555. { **** Convert dialog **** }
  556.  
  557. type
  558.   POleUIConvert = ^TOleUIConvert;
  559.   TOleUIConvert = record
  560.     cbStruct: Longint;                  { Structure Size }
  561.     dwFlags: Longint;                   { IN-OUT: Flags }
  562.     hWndOwner: HWnd;                    { Owning window }
  563.     lpszCaption: PChar;                 { Dialog caption bar contents }
  564.     lpfnHook: TFNOleUIHook;             { Hook callback }
  565.     lCustData: Longint;                 { Custom data to pass to hook }
  566.     hInstance: THandle;                 { Instance for customized template name }
  567.     lpszTemplate: PChar;                { Customized template name }
  568.     hResource: HRsrc;                   { Customized template handle }
  569.     clsid: TCLSID;                      { IN: Class ID sent in to dialog: IN only }
  570.     clsidConvertDefault: TCLSID;        { IN: use as convert default: IN only }
  571.     clsidActivateDefault: TCLSID;       { IN: use as activate default: IN only }
  572.     clsidNew: TCLSID;                   { OUT: Selected Class ID }
  573.     dvAspect: Longint;                  { IN-OUT: either DVASPECT_CONTENT or
  574.                                           DVASPECT_ICON }
  575.     wFormat: Word;                      { IN" Original data format }
  576.     fIsLinkedObject: BOOL;              { IN: true if object is linked }
  577.     hMetaPict: HGlobal;                 { IN-OUT: metafile icon image }
  578.     lpszUserType: PChar;                { IN-OUT: user type name of original class.
  579.                                           We'll do lookup if NULL. This gets freed
  580.                                           on exit }
  581.     fObjectsIconChanged: BOOL;          { OUT: TRUE == ChangeIcon was called }
  582.     lpszDefLabel: PChar;                { IN-OUT: default label to use for icon.
  583.                                           if NULL, the short user type name
  584.                                           will be used. if the object is a
  585.                                           link, the caller should pass the
  586.                                           DisplayName of the link source
  587.                                           This gets freed on exit }
  588.     cClsidExclude: Integer;             { IN: No. of CLSIDs in lpClsidExclude }
  589.     lpClsidExclude: PCLSID;             { IN: List of CLSIDs to exclude from list }
  590.   end;
  591.  
  592. function OleUIConvert(var Info: TOleUIConvert): Integer; stdcall;
  593.  
  594. { Determine if there is at least one class that can Convert or ActivateAs
  595.   the given clsid }
  596.  
  597. function OleUICanConvertOrActivateAs(const clsid: TCLSID;
  598.   fIsLinkedObject: BOOL; wFormat: Word): BOOL; stdcall;
  599.  
  600. { Convert Dialog flags }
  601.  
  602. const
  603.   CF_SHOWHELPBUTTON               = $00000001;
  604.   CF_SETCONVERTDEFAULT            = $00000002;
  605.   CF_SETACTIVATEDEFAULT           = $00000004;
  606.   CF_SELECTCONVERTTO              = $00000008;
  607.   CF_SELECTACTIVATEAS             = $00000010;
  608.   CF_DISABLEDISPLAYASICON         = $00000020;
  609.   CF_DISABLEACTIVATEAS            = $00000040;
  610.   CF_HIDECHANGEICON               = $00000080;
  611.   CF_CONVERTONLY                  = $00000100;
  612.  
  613. { Convert specific error codes }
  614.  
  615. const
  616.   OLEUI_CTERR_CLASSIDINVALID      = OLEUI_ERR_STANDARDMAX + 1;
  617.   OLEUI_CTERR_DVASPECTINVALID     = OLEUI_ERR_STANDARDMAX + 2;
  618.   OLEUI_CTERR_CBFORMATINVALID     = OLEUI_ERR_STANDARDMAX + 3;
  619.   OLEUI_CTERR_HMETAPICTINVALID    = OLEUI_ERR_STANDARDMAX + 4;
  620.   OLEUI_CTERR_STRINGINVALID       = OLEUI_ERR_STANDARDMAX + 5;
  621.  
  622. { **** Busy dialog **** }
  623.  
  624. type
  625.   POleUIBusy = ^TOleUIBusy;
  626.   TOleUIBusy = record
  627.     cbStruct: Longint;                  { Structure Size }
  628.     dwFlags: Longint;                   { IN-OUT: Flags }
  629.     hWndOwner: HWnd;                    { Owning window }
  630.     lpszCaption: PChar;                 { Dialog caption bar contents }
  631.     lpfnHook: TFNOleUIHook;             { Hook callback }
  632.     lCustData: Longint;                 { Custom data to pass to hook }
  633.     hInstance: THandle;                 { Instance for customized template name }
  634.     lpszTemplate: PChar;                { Customized template name }
  635.     hResource: HRsrc;                   { Customized template handle }
  636.     task: HTask;                        { IN: HTask which is blocking }
  637.     lphWndDialog: ^HWnd;                { IN: Dialog's HWND is placed here }
  638.   end;
  639.  
  640. function OleUIBusy(var Info: TOleUIBusy): Integer; stdcall;
  641.  
  642. { Flags for the Busy dialog }
  643.  
  644. const
  645.   BZ_DISABLECANCELBUTTON          = $00000001;
  646.   BZ_DISABLESWITCHTOBUTTON        = $00000002;
  647.   BZ_DISABLERETRYBUTTON           = $00000004;
  648.   BZ_NOTRESPONDINGDIALOG          = $00000008;
  649.  
  650. { Busy specific error/return codes }
  651.  
  652. const
  653.   OLEUI_BZERR_HTASKINVALID     = OLEUI_ERR_STANDARDMAX + 0;
  654.   OLEUI_BZ_SWITCHTOSELECTED    = OLEUI_ERR_STANDARDMAX + 1;
  655.   OLEUI_BZ_RETRYSELECTED       = OLEUI_ERR_STANDARDMAX + 2;
  656.   OLEUI_BZ_CALLUNBLOCKED       = OLEUI_ERR_STANDARDMAX + 3;
  657.  
  658. { **** Object Properties dialog **** }
  659.  
  660. type
  661.   IOleUIObjInfo = interface(IUnknown)
  662.   ['{00000000-0000-0000-0000-000000000000}'] //!!!
  663.     function GetObjectInfo(dwObject: Longint;
  664.       var dwObjSize: Longint; var lpszLabel: PChar;
  665.       var lpszType: PChar; var lpszShortType: PChar;
  666.       var lpszLocation: PChar): HResult; stdcall;
  667.     function GetConvertInfo(dwObject: Longint; var ClassID: TCLSID;
  668.       var wFormat: Word; var ConvertDefaultClassID: TCLSID;
  669.       var lpClsidExclude: PCLSID; var cClsidExclude: Longint): HResult; stdcall;
  670.     function ConvertObject(dwObject: Longint; const clsidNew: TCLSID): HResult; stdcall;
  671.     function GetViewInfo(dwObject: Longint; var hMetaPict: HGlobal;
  672.       var dvAspect: Longint; var nCurrentScale: Integer): HResult; stdcall;
  673.     function SetViewInfo(dwObject: Longint; hMetaPict: HGlobal;
  674.       dvAspect: Longint; nCurrentScale: Integer;
  675.       bRelativeToOrig: BOOL): HResult; stdcall;
  676.   end;
  677.  
  678. type
  679.   IOleUILinkInfo = interface(IOleUILinkContainer)
  680.   ['{00000000-0000-0000-0000-000000000000}']  //!!!
  681.     function GetLastUpdate(dwLink: Longint; var LastUpdate: TFileTime): HResult; stdcall;
  682.   end;
  683.  
  684. type
  685.   POleUIGnrlProps = ^TOleUIGnrlProps;
  686.   TOleUIGnrlProps = record
  687.     cbStruct: Longint;
  688.     dwFlags: Longint;
  689.     dwReserved1: array[1..2] of Longint;
  690.     lpfnHook: TFNOleUIHook;
  691.     lCustData: Longint;
  692.     dwReserved2: array[1..3] of Longint;
  693.     lpOP: Pointer;
  694.   end;
  695.  
  696. type
  697.   POleUIViewProps = ^TOleUIViewProps;
  698.   TOleUIViewProps = record
  699.     cbStruct: Longint;
  700.     dwFlags: Longint;
  701.     dwReserved1: array[1..2] of Longint;
  702.     lpfnHook: TFNOleUIHook;
  703.     lCustData: Longint;
  704.     dwReserved2: array[1..3] of Longint;
  705.     lpOP: Pointer;
  706.     nScaleMin: Integer;
  707.     nScaleMax: Integer;
  708.   end;
  709.  
  710. { Flags for TOleUIViewProps }
  711.  
  712. const
  713.   VPF_SELECTRELATIVE          = $00000001;  { IN: relative to orig }
  714.   VPF_DISABLERELATIVE         = $00000002;  { IN: disable relative to orig }
  715.   VPF_DISABLESCALE            = $00000004;  { IN: disable scale option }
  716.  
  717. type
  718.   POleUILinkProps = ^TOleUILinkProps;
  719.   TOleUILinkProps = record
  720.     cbStruct: Longint;
  721.     dwFlags: Longint;
  722.     dwReserved1: array[1..2] of Longint;
  723.     lpfnHook: TFNOleUIHook;
  724.     lCustData: Longint;
  725.     dwReserved2: array[1..3] of Longint;
  726.     lpOP: Pointer;
  727.   end;
  728.  
  729. type
  730.   POleUIObjectProps = ^TOleUIObjectProps;
  731.   TOleUIObjectProps = record
  732.     cbStruct: Longint;          { Structure Size }
  733.     dwFlags: Longint;           { IN-OUT: global flags for the sheet }
  734.     lpPS: PPropSheetHeader;     { IN: property sheet header }
  735.     dwObject: Longint;          { IN: identifier for the object }
  736.     lpObjInfo: IOleUIObjInfo;   { IN: interface to manipulate object }
  737.     dwLink: Longint;            { IN: identifier for the link }
  738.     lpLinkInfo: IOleUILinkInfo; { IN: interface to manipulate link }
  739.     lpGP: POleUIGnrlProps;      { IN: general page }
  740.     lpVP: POleUIViewProps;      { IN: view page }
  741.     lpLP: POleUILinkProps;      { IN: link page }
  742.   end;
  743.  
  744. function OleUIObjectProperties(var Info: TOleUIObjectProps): Integer; stdcall;
  745.  
  746. { Flags for OLEUIOBJECTPROPS }
  747.  
  748. const
  749.   OPF_OBJECTISLINK                = $00000001;
  750.   OPF_NOFILLDEFAULT               = $00000002;
  751.   OPF_SHOWHELP                    = $00000004;
  752.   OPF_DISABLECONVERT              = $00000008;
  753.  
  754. { Errors for OleUIObjectProperties }
  755.  
  756. const
  757.   OLEUI_OPERR_SUBPROPNULL           = OLEUI_ERR_STANDARDMAX + 0;
  758.   OLEUI_OPERR_SUBPROPINVALID        = OLEUI_ERR_STANDARDMAX + 1;
  759.   OLEUI_OPERR_PROPSHEETNULL         = OLEUI_ERR_STANDARDMAX + 2;
  760.   OLEUI_OPERR_PROPSHEETINVALID      = OLEUI_ERR_STANDARDMAX + 3;
  761.   OLEUI_OPERR_SUPPROP               = OLEUI_ERR_STANDARDMAX + 4;
  762.   OLEUI_OPERR_PROPSINVALID          = OLEUI_ERR_STANDARDMAX + 5;
  763.   OLEUI_OPERR_PAGESINCORRECT        = OLEUI_ERR_STANDARDMAX + 6;
  764.   OLEUI_OPERR_INVALIDPAGES          = OLEUI_ERR_STANDARDMAX + 7;
  765.   OLEUI_OPERR_NOTSUPPORTED          = OLEUI_ERR_STANDARDMAX + 8;
  766.   OLEUI_OPERR_DLGPROCNOTNULL        = OLEUI_ERR_STANDARDMAX + 9;
  767.   OLEUI_OPERR_LPARAMNOTZERO         = OLEUI_ERR_STANDARDMAX + 10;
  768.   OLEUI_GPERR_STRINGINVALID         = OLEUI_ERR_STANDARDMAX + 11;
  769.   OLEUI_GPERR_CLASSIDINVALID        = OLEUI_ERR_STANDARDMAX + 12;
  770.   OLEUI_GPERR_LPCLSIDEXCLUDEINVALID = OLEUI_ERR_STANDARDMAX + 13;
  771.   OLEUI_GPERR_CBFORMATINVALID       = OLEUI_ERR_STANDARDMAX + 14;
  772.   OLEUI_VPERR_METAPICTINVALID       = OLEUI_ERR_STANDARDMAX + 15;
  773.   OLEUI_VPERR_DVASPECTINVALID       = OLEUI_ERR_STANDARDMAX + 16;
  774.   OLEUI_LPERR_LINKCNTRNULL          = OLEUI_ERR_STANDARDMAX + 17;
  775.   OLEUI_LPERR_LINKCNTRINVALID       = OLEUI_ERR_STANDARDMAX + 18;
  776.   OLEUI_OPERR_PROPERTYSHEET         = OLEUI_ERR_STANDARDMAX + 19;
  777.  
  778. { wParam used by PSM_QUERYSIBLINGS }
  779.  
  780. const
  781.   OLEUI_QUERY_GETCLASSID          = $FF00;  { override class id for icon }
  782.   OLEUI_QUERY_LINKBROKEN          = $FF01;  { after link broken }
  783.  
  784. implementation
  785.  
  786. const
  787.   OleDlgDLL = 'oledlg.dll';
  788.  
  789. function OleUIAddVerbMenu;              external OleDlgDLL name 'OleUIAddVerbMenuA';
  790. function OleUIInsertObject;             external OleDlgDLL name 'OleUIInsertObjectA';
  791. function OleUIPasteSpecial;             external OleDlgDLL name 'OleUIPasteSpecialA';
  792. function OleUIEditLinks;                external OleDlgDLL name 'OleUIEditLinksA';
  793. function OleUIChangeIcon;               external OleDlgDLL name 'OleUIChangeIconA';
  794. function OleUIConvert;                  external OleDlgDLL name 'OleUIConvertA';
  795. function OleUICanConvertOrActivateAs;   external OleDlgDLL name 'OleUICanConvertOrActivateAs';
  796. function OleUIBusy;                     external OleDlgDLL name 'OleUIBusyA';
  797. function OleUIObjectProperties;         external OleDlgDLL name 'OleUIObjectPropertiesA';
  798.  
  799. end.
  800.